home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / gnat1792.zip / gnat179b / djgpp.faq < prev    next >
Text File  |  1994-06-01  |  14KB  |  264 lines

  1. Q: What's the minimum set of .zip files I need for compiling programs?
  2. A: djeoeXXX, djdevXXX, gccXXXbn, gasXXXbn, and bnuXXbn are required.  The
  3.    remainder are for additional functionality.  Note that the version
  4.    numbers do not neccessarily match between FSF programs (gas and gcc)
  5.    and my programs (go32).  You'll also need bsnXXXbn for bison and
  6.    flxXXXbn for flex, where XXX is the version number.
  7.    
  8.    Note that C++ requires gppXXX.zip, and ObjectiveC requires objcXXX.zip.
  9.    The C++ library includes obstacks, alloca, and regex, so you need to
  10.    get gppXXX.zip to use them (libgpl.a)
  11.  
  12. Q: I need 1.11.maint1!
  13. A: Get and install dj111m1.zip (and dj111m2.zip, etc).  These are
  14.    maintainence releases, and include updates to go32 and other programs.
  15.    They should be installed in order and after all other modules.
  16.  
  17. Q: What about documentation?
  18. A: Get txiXXX.bn, which includes INFO.EXE.  Unpack it and run "info".  It
  19.    will bring up a (hopefully) self-explanatory online help system.
  20.  
  21.    For go32 and programs I wrote, get djdocXXX.zip, which includes the
  22.    data files for the online help system.
  23.  
  24.    For the FSF utilities, djgpp includes three files each.  Example:
  25.     gcc257bn.zip - binaries & source diffs for gcc 2.5.7
  26.     gcc257dc.zip - documentation for gcc 2.5.7
  27.     gcc257sr.zip - original FSF sources for gcc 2.5.7
  28.  
  29.    (Some sources are too big, and are split into multiple zips, all
  30.    of which must be unzipped to get a complete source distribution:
  31.         gcc257s1.zip
  32.         gcc257s2.zip
  33.         gcc257s3.zip
  34.    All sources are shipped in ready-to-build form.  The diffs in
  35.    the diffs directory have already been applied.)
  36.  
  37. Q: How do I find out what go32 is doing?
  38. A: The first thing to do is run "go32".  It will give you gobs of
  39.    information about what it knows about your system and itself.
  40.    Next, set the "topline" flag in the GO32 environment varable
  41.    (see the README) and watch the top line of your screen.  The
  42.    info there tells you something about what the program is doing.
  43.  
  44. Q: I get errors I can't figure out when I try to compile something.
  45. A: The best way to figure out what's going wrong with gcc is to
  46.    use the "-v" switch.  For example, if you run "gcc -v hello.c"
  47.    (assuming you have hello.c), it will tell you all the programs
  48.    it is running.  Then, you can see which program caused the
  49.    error.  The most likely cause of errors relating to missing
  50.    programs is that you haven't unpacked the zip file with
  51.    one of the compiler passes or utilities on it. 
  52.  
  53. Q: Why do I get so many unresolved symbols when linking C++ programs?
  54. A: The C++ libraries are not in libc.a, which is the only default
  55.    library.  You must use a command like this:
  56.        gcc -o prog prog.o -lgpp -lm
  57.    Note that some C++ classes use math routines, so the -lm should be
  58.    given after the -lgplus.  If you don't link with -lgpl or -lgpp,
  59.    you won't include any GPL code in your application.  You may not
  60.    need all of these libraries for your program. 
  61.  
  62. Q: How do I debug my programs?
  63. A: First, remember to use the -g switch when you compile.  This puts debugging
  64.    information into your executable.  Then, to debug the program, use a
  65.    command line like this:
  66.       go32 -d edebug32 myprog
  67.    "edebug32" is the external debugger.  See the file "edebug32.doc" for
  68.    information on the debugger commands.  Note: if you are running in a
  69.    DPMI environment, you must use "ed32-dpmi" instead of "edebug32".  Go32
  70.    normally searches relative to the current directory, then from it's own
  71.    directory, then the PATH, for the external debugger program. 
  72.  
  73. Q: When I run my programs under Windows, they crash, but not outside of
  74.    Windows.
  75. A: You may have used the "-fomit-frame-pointer" option to GCC.  This
  76.    tells gcc that it can use EBP as a general register.  However, the
  77.    segment used for the stack is protected against access outside of
  78.    calculated stack range, and EBP causes the stack selector to be used.
  79.    If you use this to access memory in the regular data area, you get
  80.    a protection fault.  This mechanism is present to prevent you from
  81.    using so much stack that you begin corrupting data.  Outside of
  82.    Windows, a different method is used to detect stack overrun, so you
  83.    don't see this fault.
  84.  
  85. Q: How do I create symbolic links?
  86. A: Copy bin/stub.exe to the name of the link you want.  In this example,
  87.    let's say the real program is dj1.exe and we want to make a link called
  88.    dj2.exe that really calls dj1.exe.  We'd copy stub.exe to dj2.exe.
  89.    Next, run stubedit to modify the new programs' stub info block to change
  90.    the name of the executable it runs.  In this case, we'd change it to
  91.    dj1.  When you run dj2 now, it tells go32 to use the image of dj1.
  92.      C:\> copy c:\djgpp\bin\stub.exe c:\usr\bin\dj2.exe
  93.      C:\> stubedit c:/usr/bin/dj2.exe runfile=dj1
  94.  
  95. Q: When I run "gcc e:\proj\prog.c" it says "undefined escape sequence \p"?
  96. A: Gcc is a *unix* compiler - you must use *unix* slashes (e:/proj/prog.c).
  97.    Environment variables (like GCCINC) may, however, use either, as they
  98.    are converted.
  99.  
  100. Q: I type "GCC PROG.C" and ld complains about PROG.C not being an object.
  101. Q: I type "gcc prog.cxx" to compile a C++ program, and ld complains.
  102. A: Gcc is *not* case insensitive like DOS is, and it uses the file's
  103.    extension to determine how to compile a file.  Valid extensions are:
  104.      .cc = C++ source (passed through cpp)
  105.      .c = C source that must be passed through cpp first
  106.      .i = raw C source (no cpp pass)
  107.      .S = assembler that must be passed through cpp first
  108.      .s = raw assembler source (no cpp pass)
  109.    any other file is passed to the linker
  110.  
  111. Q: I compile my program, but can't run the output file.
  112. A: DOS doesn't know how to run unix-style COFF files.  That's what the
  113.    extender is for.  To run an COFF file called myprog, type
  114.      "go32 myprog . . ."
  115.  
  116. Q: I compile my program, but when I run the .exe it hangs.
  117. A: Most likely, you did this: "gcc foo.c -o foo.exe".  This doesn't
  118.    create a real .EXE file.  That's like renaming your phone directory
  119.    file to an .EXE and expecting it to run.  You must use the COFF2EXE
  120.    program to convert the output of gcc to a real executable. 
  121.  
  122. Q: Gcc doesn't recognize // as a comment in my C programs.
  123. A: That's because // isn't a comment in C.  If you want to compile C++,
  124.    then write C++ programs.  Gcc is really two compilers in one, not
  125.    one compiler that compiles both C and C++.  That's why you get
  126.    cc1 and cc1plus.
  127.  
  128. Q: I'm reading in data files, but the data gets corrupted.
  129. A: The default file type is DOS text, even for read() and write().  You must
  130.    tell the system that a file is binary through the "b" flag in fopen(),
  131.    or O_BINARY in open() or setmode().
  132.  
  133. Q: I get "fatal signal 2" when I run gcc.
  134. A: When gcc reports a "signal", it really means that an error occurred
  135.    trying to run the given program.  The "signal" number is the DOS error
  136.    code, and 2 means "file not found".  Check the COMPILER_PATH environment
  137.    variable and make sure it points to the directory with cpp.exe,
  138.    cc1.exe, etc.
  139.  
  140. Q: The binaries I get with the distribution are .exe files, but gcc creates
  141.    COFF files.  I rename the COFF's to .EXE's, but they still don't work.
  142. A: To get an .EXE from an COFF, you must *prepend* either go32.exe
  143.    or stub.exe to the file.  A program called "coff2exe" is provided to
  144.    do this.  Just run "coff2exe myprog".
  145.  
  146. Q: What is stub.exe?
  147. A: Stub.exe simply calles go32.exe, and passes it information it needs to
  148.    run the COFF file attached to it.  Stub is much smaller than go32, so
  149.    less disk space is used.  Also, if you change go32, you don't have to
  150.    change stub, and all the stub-ized programs will use the new go32
  151.    automatically.
  152.  
  153. Q: I want to change cc1.  How do I do this?
  154. A: First, get the GNU sources.  These should be the "gccXXXsr.zip"
  155.    files found in the djgpp distribution.  You can also get the latest
  156.    versions from the FSF if you like.  They're usually available at
  157.    prep.ai.mit.edu in /pub/gnu, if not els